package com.biz.common.dao;

import java.io.Serializable;
import java.util.List;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.DetachedCriteria;
import org.springframework.dao.DataAccessException;

public interface GenericDAO<T, PK extends Serializable> {
	public PK insert(T entity) throws DataAccessException;

	public void update(T entity) throws DataAccessException;

	public void delete(Class<T> entityClazz, PK id) throws DataAccessException;

	public T query(Class<T> entityClazz, PK id) throws DataAccessException;

	public List<T> getAll(Class<T> entityClazz) throws DataAccessException;
	
	public List<T> queryForPaging(final DetachedCriteria criteria, final int pageNo, final int pageSize)
	throws DataAccessException;
	
	public List<T> queryForHQLPaging(final String hql, final int pageNo, final int pageSize) throws DataAccessException;
	
	public List<T> queryForCriteriaPaging(final Class<T> entityClazz, final Criterion[] criterions, final int pageNo,
			final int pageSize) throws DataAccessException;
}
